var meizu_img=document.getElementsByClassName("meizu_img")
var banner = document.getElementById('banner');
var img = document.getElementById('img');
var click_btn = document.getElementsByClassName('click_btn');
var color =['#E7FAFF','#FFFFFF','#121212','#E0E7F9','#E4E4E4','#EBEBEB'];
var num =0;
function run () {
	
	for (var i =0 ; i<meizu_img.length;i++) {
		meizu_img[i].style.display="none";
		click_btn[i].style.backgroundColor="rgba(0,0,0,0)";
	};
	meizu_img[num].style.display="block";
	banner.style.backgroundColor=color[num];
	click_btn[num].style.backgroundColor="#00C3F5";

	if(num == meizu_img.length-1){
		num=0;
	}
	else{
		num++;
	}
}
run();

var time = setInterval(run, 2000);

img.onmouseover = function  (argument) {
	clearInterval(time);
}
img.onmouseout = function  (argument) {
	time = setInterval(run, 2000);
}

for (var i = 0; i<click_btn.length; i++) {

	click_btn[i].onmouseover = function  () {
		this.style.backgroundColor="rgba(0,195,245,1)";
	}

	click_btn[i].onmouseout = function  () {
		this.style.backgroundColor="rgba(0,195,245,0)";
		if(num==0){
			click_btn[click_btn.length-1].style.backgroundColor="rgba(0,195,245,1)";
		}else{
			click_btn[num-1].style.backgroundColor="rgba(0,195,245,1)";
		}
		
	}
 
	buttonclick(i);

};

function buttonclick (i) {
	click_btn[i].onclick = function  () {
		num = i;
		run();
	}
}
